package com.ctg.behavior.calc.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.ctg.behavior.common.CtgIdResult;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@RequestMapping("/api/mock")
public class CtMockController {

	@Value("${simulator.path}")
	private String simlutorPath;
	
	@GetMapping("/error")
	public CtgIdResult getError() throws Exception {

		CtgIdResult result = new CtgIdResult();
		result.setErrorCode("500");
		result.setSuccess(false);
		result.setErrorMessage("这是模拟错误信息");
		
		log.info(JSON.toJSONString(result));

		return result;
	}
	
	@PostMapping("/error")
	public CtgIdResult postError() throws Exception {

		CtgIdResult result = new CtgIdResult();
		result.setErrorCode("500");
		result.setSuccess(false);
		result.setErrorMessage("这是模拟错误信息");
		
		log.info(JSON.toJSONString(result));

		return result;
	}
	
}
